package com.quick.threadtest;

/**
 * @ClassName JoinTest
 * @Description TODO
 * @Author Wangxin
 * @Date 2019-02-17 14:21
 * @Version 1.0
 **/
public class JoinTest {
    public static void main(String[] args) throws Exception{
        Thread thread1 = new Thread(new th());
        Thread thread2 = new Thread(new th());
        thread1.start();
        thread1.join();
        System.out.println("1执行完成");
        thread2.start();
        System.out.println("2执行完成");
        thread2.join();
        System.out.println("全部执行完毕");
    }

}
class th implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName());
        }
    }
}

